<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>相对定位</title>
</head>
<style>
    .fu{
        background-color: #ff0;
    }
    .fu>div{
        width: 100px;
        height: 100px;
    }
    .z1 {
        background-color: #f00;
    }
    .z2 {
        position: fixed;
        /*参照物永远都是html,会脱离文档流*/
        /*right: 50px;*/
        top: 0;
        right: 0;
        background-color: #0f0;
    }
    .z3 {
        position: relative;
        background-color: #00f;
        z-index: 11;
    }

</style>
<body>
<div class="fu">
    <div class="z1"></div>
    <div class="z2"></div>
    <div class="z3"></div>
</div>
</body>
</html>